// stores/consult.ts
import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { Image } from '@/types/consult'

export interface ConsultInfo {
  illnessDesc: string;
  illnessTime: number;
  consultFlag: number;
  pictures: Image[];
}

export const useConsultStore = defineStore(
  'consult',
  () => {
    // 患者病情初始数据
    const initalValue = {
      illnessDesc: '',
      illnessTime: 1,
      consultFlag: 0,
      pictures: [] ,
    }

    // 极速问诊
      const type = ref('')
      // 问诊类型
      const illnessType = ref('')
      // 科室ID
      const depId = ref('')

          // 患者ID
    const patientId = ref('')
    // 患者病情数据
    const illnessInfo = ref<ConsultInfo>({ ...initalValue })

        // 清空参数
    const clear = () => {
      illnessInfo.value = { ...initalValue }
      type.value = ''
      illnessType.value = ''
      depId.value = ''
      patientId.value = ''
    }

    return { illnessInfo, initalValue,type, illnessType, depId, patientId, clear }
  },
  {
    unistorage: true
  }
)